//
//  LBRouterAction.h
//  LBRouter
//
//  Created by WuShiHai on 19/5/24.
//  Copyright (c) 2019 Lebbay. All rights reserved.
//

#ifndef LBRouterAction_h
#define LBRouterAction_h

#import <Foundation/Foundation.h>
#import "LBRouterTypeDefine.h"

typedef void (^LBRouterActionCallbackBlock)(void);
typedef BOOL (^LBRouterHandleDecideBlock)(NSString *router);

@interface LBRouterAction : NSObject

/**
 添加RouterTypeNativeCallback类型回调

 @param callbackType callback 具体类型 LBRouterNativeCallbackShare or LBRouterNativeCallbackRefresh
 @param complteHandler 回调
 */
- (void)addRouterCallbackAction:(NSString *)callbackType
                 complteHandler:(LBRouterActionCallbackBlock)complteHandler;

/**
 对于一些需要跳转前处理业务逻辑的参数，调用此方法，注册判断用的block

 @param decideHandler 判断是否由底层处理router
 */
- (void)addDecideHandler:(LBRouterHandleDecideBlock)decideHandler;

/**
 调用Router的 openURL:completion:方法后，在completion中使用该方法进行解析

 @param type router识别出来的类型
 @param URLString 完整链接
 @param paths 关键字段
 @param userInfo 信息
 @return 是否成功调原生
 */
- (BOOL)routerComplete:(LBRouterType)type
             URLString:(NSString *)URLString
                 paths:(NSString *)paths
              userInfo:(NSDictionary *)userInfo;

@property (nonatomic, copy, readonly) LBRouterHandleDecideBlock decideHandler;

@end

#endif
